/*
 * Copyright (C) 2014 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 */


#include "app_basic.h"

MIB_TABLE_INFO_T gMibSIPUserDataTableInfo;
MIB_ATTR_INFO_T  gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ATTR_NUM];
MIB_TABLE_SIPUSERDATA_T gMibSIPUserDataDefRow;
MIB_TABLE_OPER_T gMibSIPUserDataOper;

GOS_ERROR_CODE SIPUserDataDrvCfg(void* pOldRow, void* pNewRow, MIB_OPERA_TYPE operationType, MIB_ATTRS_SET attrSet, UINT32 pri)
{

	omci_voice_vendor_t     voice_vendor;
	MIB_TABLE_VOIPCONFIGDATA_T   mibVcd;

	voice_vendor = (gInfo.voiceVendor ? VOICE_VENDOR_RTK : VOICE_VENDOR_NONE);


    OMCI_LOG(OMCI_LOG_LEVEL_DBG, "Start %s...", __FUNCTION__);

    switch (operationType)
    {
    case MIB_ADD:
    	OMCI_LOG(OMCI_LOG_LEVEL_DBG,"SIPUserData --> ADD");
    	break;
    case MIB_DEL:
	OMCI_LOG(OMCI_LOG_LEVEL_DBG, "SIPUserData --> %s", (MIB_DEL == operationType ? (STR(MIB_DEL)) : (STR(MIB_SET))));	
		mibVcd.EntityId = 0;
		if (GOS_OK == MIB_Get(MIB_TABLE_VOIPCONFIGDATA_INDEX, &mibVcd, sizeof(MIB_TABLE_VOIPCONFIGDATA_T)) &&
		mibVcd.VOIPConfigurationMethodUsed == VCD_CFG_METHOD_USED_OMCI)
		{
			VOICE_WRAPPER(omci_voice_config_reset);
		}	
	break;
    case MIB_SET:
        OMCI_LOG(OMCI_LOG_LEVEL_DBG, "SIPUserData --> %s", (MIB_DEL == operationType ? (STR(MIB_DEL)) : (STR(MIB_SET))));
        omci_voice_vendor_service_cb(voice_vendor, NULL);
    	break;
    default:
    	break;
    }

    return GOS_OK;
}
GOS_ERROR_CODE mibTable_init(MIB_TABLE_INDEX tableId)
{
    gMibSIPUserDataTableInfo.Name = "SIPUserData";
    gMibSIPUserDataTableInfo.ShortName = "SIPUD";
    gMibSIPUserDataTableInfo.Desc = "SIP user data";
    gMibSIPUserDataTableInfo.ClassId = (UINT32)(OMCI_ME_CLASS_SIP_USER_DATA);
    gMibSIPUserDataTableInfo.InitType = (UINT32)(OMCI_ME_INIT_TYPE_OLT);
    gMibSIPUserDataTableInfo.StdType = (UINT32)(OMCI_ME_TYPE_STANDARD);
    gMibSIPUserDataTableInfo.ActionType = (UINT32)(OMCI_ME_ACTION_CREATE | OMCI_ME_ACTION_DELETE | OMCI_ME_ACTION_SET | OMCI_ME_ACTION_GET);
    gMibSIPUserDataTableInfo.pAttributes = &(gMibSIPUserDataAttrInfo[0]);

    gMibSIPUserDataTableInfo.attrNum = MIB_TABLE_SIPUSERDATA_ATTR_NUM;
    gMibSIPUserDataTableInfo.entrySize = sizeof(MIB_TABLE_SIPUSERDATA_T);
    gMibSIPUserDataTableInfo.pDefaultRow = &gMibSIPUserDataDefRow;

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Name = "EntityId";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPAgentPointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].Name = "UserPartAOR";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPDisplayName";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].Name = "UsernamePassword";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].Name = "VoicemailServerSIPURI";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].Name = "VoicemailSubscriptionExpirationTime";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "NetworkDialPlanPointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ApplicationServicesProfilePointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "FeatureCodePointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "PPTPPointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ReleaseTimer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ROHTimer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPResponseTable";

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Entity ID";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP agent pointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "User part AOR";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP display name";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Username password";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Voicemail server SIP URI";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Voicemail subscription expiration time";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Network dial plan pointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Application services profile pointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Feature code pointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "PPTP pointer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Release timer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "ROH timer";
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP response table";

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_STR;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_TABLE;

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].Len = 25;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].Len = 5;

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_CHAR;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_CHAR;

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE;

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;

    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERPARTAOR_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPDISPLAYNAME_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_USERNAMEPASSWORD_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSERVERSIPURI_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_VOICEMAILSUBSCRIPTIONEXPIRATIONTIME_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_NETWORKDIALPLANPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_APPLICATIONSERVICESPROFILEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_FEATURECODEPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_PPTPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_RELEASETIMER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_OPTIONAL;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_ROHTIMER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_OPTIONAL;
    gMibSIPUserDataAttrInfo[MIB_TABLE_SIPUSERDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_OPTIONAL;

    gMibSIPUserDataDefRow.EntityId = 0;
    gMibSIPUserDataDefRow.SIPAgentPointer = 0;
    gMibSIPUserDataDefRow.UserPartAOR = 0xffff;
    strncpy(gMibSIPUserDataDefRow.SIPDisplayName, "0", sizeof(gMibSIPUserDataDefRow.SIPDisplayName));
    gMibSIPUserDataDefRow.UsernamePassword = 0;
    gMibSIPUserDataDefRow.VoicemailServerSIPURI = 0xffff;
    gMibSIPUserDataDefRow.VoicemailSubscriptionExpirationTime = 3600;
    gMibSIPUserDataDefRow.NetworkDialPlanPointer = 0xffff;
    gMibSIPUserDataDefRow.ApplicationServicesProfilePointer = 0xffff;
    gMibSIPUserDataDefRow.FeatureCodePointer = 0xffff;
    gMibSIPUserDataDefRow.PPTPPointer = 0xffff;
    gMibSIPUserDataDefRow.ReleaseTimer = 10;
    gMibSIPUserDataDefRow.ROHTimer = 15;
    memset(gMibSIPUserDataDefRow.SIPResponseTable, 0x00, 5);

    memset(&gMibSIPUserDataOper, 0x0, sizeof(MIB_TABLE_OPER_T));
    gMibSIPUserDataOper.meOperDrvCfg = SIPUserDataDrvCfg;
    gMibSIPUserDataOper.meOperConnCheck = NULL;
    gMibSIPUserDataOper.meOperDump = omci_mib_oper_dump_default_handler;
    gMibSIPUserDataOper.meOperConnCfg = NULL;
    gMibSIPUserDataOper.meOperAvlTreeAdd = NULL;
    gMibSIPUserDataOper.meOperAlarmHandler = NULL;
    gMibSIPUserDataOper.meOperTestHandler = NULL;

    MIB_TABLE_SIPUSERDATA_INDEX = tableId;
    MIB_InfoRegister(tableId, &gMibSIPUserDataTableInfo, &gMibSIPUserDataOper);
    MIB_RegisterCallback(tableId, NULL, NULL);

    return GOS_OK;
}

